Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: optimistically compile go modules while extracting schema #3385

Merged
merged 6 commits into from
Nov 15, 2024

Conversation

matt2e
Copy link
Collaborator

@matt2e matt2e commented Nov 14, 2024

Description

  • The two longest parts to build a go module is schema extraction and compilation.
  • Some code changes (like a verb changing name, or sumtype changes) require compilation to happen after schema extraction so that we can generate code based on the latest schema.
  • During development though, most builds will be done with compilation not dependant on schema extraction.
  • This PR optimises for this case by optimistically compiling while schema extraction occurs if previous code generation is present. After the schema is extracted we then generate code and check if anything has changed that requires re-compilation.

Performance

Ran ftl dev examples/go/time, waiting for the initial builds to complete, and then modified the module code 20 times to get an average.

Case Small Change Verb Change
Last week's code 2.24s 3.01s
With smart go mod tidy detection 1.76s (-27%) 2.99s (~0%)
With optimistic compile (This PR) 1.30s (-72%) 3.14s (+5%)

@ftl-robot ftl-robot mentioned this pull request Nov 14, 2024
@matt2e matt2e marked this pull request as ready for review November 15, 2024 01:44
@matt2e matt2e requested review from a team and alecthomas as code owners November 15, 2024 01:44
@matt2e matt2e merged commit 8b8e468 into main Nov 15, 2024
92 checks passed
@matt2e matt2e deleted the matt2e/go-optimistic branch November 15, 2024 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant